import {Service, util, action, post} from "adajs";

class StatusService extends Service {
	defaultData() {
		return {
			running: false,
			stack: []
		};
	}

	onupdate(current, data) {
		return util.extend(current, data);
	}

	@action("run")
	runTask(current, id) {
		return post("/task/run", {taskid: id}).then(() => current);
	}

	@action("reset")
	reset(current, data) {
		return util.extend(current, data);
	}
}

export default StatusService;